<h1><?= __('activities') ?></h1>
<p><?= $this->Html->link('+'.__('new activity'), '/activities/create') ?></p>

<table>
	
	<tr>
		<th><?= __('date') ?></th>
		<th><?= __('type') ?></th>
		<th><?= __('category') ?></th>
		<th><?= __('choir') ?></th>
		<th><?= __('conductor') ?></th>
		<th><?= __('members') ?></th>
		<th></th>
	</tr>
	
	<? if(!empty($data)): ?>
		<? foreach($data as $activity): ?>
		<tr>
			<td><?= $this->Html->link(date('d.M Y', strtotime($activity["Activity"]["date"])), '/activities/edit/' . $activity['Activity']['id']) ?></td>
			<td><?= __($activity["Activity"]["type"]) ?></td>
			<td><?= __($activity["Activity"]["category"]) ?></td>
			<td><?= __($activity["Activity"]["choir"]) ?></td>
			<td><?= $this->Html->link($activity["Conductor"]["firstname"]." ".$activity["Conductor"]["surname"], '/members/edit/'.$activity['Activity']['conductor_member_id']) ?></td>
			<td>
				<? foreach(Set::combine($activity['Member'], '{n}.id', array('{0} {1}', '{n}.firstname', '{n}.surname')) as $id=>$name): ?>
				- <?= $this->Html->link($name, "/members/edit/$id") ?><br>
				<? endforeach; ?>
			</td>
			<td>
				<?= $this->Html->link(__('delete'), array('action'=>'delete', $activity['Activity']['id']), array('onclick'=>"return confirm('".__("Do you want to delete activity?")."')")) ?>
			</td>
		</tr>
		<? endforeach; ?>
	<? else: ?>
	<tr><td colspan="5"><?= __('Empty') ?>.</td></tr>
	<? endif ?>
</table>
<?= $this->element('pagination') ?>
